Skip to content

fix(checkin): read Analytics Engine failures by body shape - #709

Merged
harlan-zw merged 1 commit into
mainfrom
fix/checkin-analytics-engine-reason
Nov 18, 2026
Merged

harlan-zw merged 1 commit into
mainfrom
fix/checkin-analytics-engine-reason

Conversation

@harlan-zw

@harlan-zw harlan-zw commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Follow-up to the logged findings on #706. No GitHub issue.

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

A rejected Analytics Engine request copied its whole body into the check-in reason. An API gateway error, such as a 401, showed a raw JSON envelope, and a proxy error showed 300 characters of HTML.

The reason now depends on the body: the gateway's errors[].message for a JSON envelope, the message itself for a plain-text SQL error, and only the status for an HTML page. The 300-character cut now counts code points, so it never splits a surrogate pair. A new test pins the GraphQL success shape with errors: null, so a stricter check cannot fail every Worker read unnoticed.

🤖 AI disclosure: Harlan Agent Kit modified this description. My AI open-source policy.

A rejected Analytics Engine request copied its whole body into the
reason, so an API gateway error showed a raw JSON envelope and a proxy
error showed HTML. The reason now takes the gateway's error messages,
keeps a plain-text SQL message, and drops HTML. The length cut no longer
splits a surrogate pair, and a test pins the GraphQL `errors: null`
success shape.
@harlan-zw

Copy link
Copy Markdown
Collaborator Author

🤖 Harlan Agent Kit Agent assessment of head 1c55315.

The Service Review was stopped for this head because the Service reported ReserveReached and the review engine is down. An independent read-only subagent reviewed the diff. This is not a Service READY.

No blocker found (confidence 95/100). With main's code, the new 401 and 502 tests fail. A live gateway envelope, fetched with a dummy account and no token, parses to its message. Twelve fuzzed errors shapes give the same Workers result as main.

Logged follow-ups, none above 80:

  • Impact 10: a JSON body without an errors[].message string ({"error":...}, {"message":...}, a bare number) now gives only the status, where main printed it. Fall back to the raw text when no message is found and the body is not HTML.
  • Impact 5: the cut keeps surrogate pairs whole but can still split a flag or a joined emoji. I corrected the description to say "surrogate pair". No test pins the boundary yet.
  • Impact 3: the parseJson comment no longer fits the Analytics Engine caller.

@harlan-zw
harlan-zw merged commit 48986bf into main Nov 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant